package Tween
{
	import Objects.GameObject;
	
	import Plugin.TweenObjectPlugin;
	import Plugin.TweenPlugin;
	
	import flash.geom.Point;
	
	public class MoveTween extends TweenObjectPlugin
	{
		public var bezier:Point;
		
		public var startX:Number = 0;
		public var startY:Number = 0;
		
		public var endX:Number=0;
		public var endY:Number=0;
		
		override protected function _update():void
		{
			if(time==0)return;
			
			var x:Number = 0;
			var y:Number = 0;
			if(bezier)
			{
				var t:Number=easeing(time,0,1-0,duration);
				x=Math.pow(1-t,2)*startX+2*t*(1-t)*bezier.x+Math.pow(t,2)*endX;
				y=Math.pow(1-t,2)*startY+2*t*(1-t)*bezier.y+Math.pow(t,2)*endY;
			}
			else
			{
				x = easeing(time,startX,endX-startX,duration);
				y = easeing(time,startY,endY-startY,duration);
			}
			go.moveTo(x,y,handleX,handleY);
		}
	}
}